package com.yuewen.permissioncheck.asm.checker;

/**
 * 大概位置
 *
 * @author zhanglulu
 */
public class PhoneStatePermission extends BasePermission {

  //TelephonyManager.class.getName(), "getImei", PermissionEnum.READ_PHONE_STATE);
  //TelephonyManager.class.getName(), "getAvailableNetworks", PermissionEnum.READ_PHONE_STATE);
  //TelephonyManager.class.getName(), "getCallState", PermissionEnum.READ_PHONE_STATE);
  //TelephonyManager.class.getName(), "getDataNetworkType", PermissionEnum.READ_PHONE_STATE);
  //TelephonyManager.class.getName(), "getDataState", PermissionEnum.READ_PHONE_STATE);
  //TelephonyManager.class.getName(), "getDeviceId", PermissionEnum.READ_PHONE_STATE);
  //ContextWrapper.class.getName(), "getSystemService", PermissionEnum.READ_PHONE_STATE, Context.TELEPHONY_SERVICE, String.class);

  @Override
  boolean check(InvokeParam param) {
    return "getSystemService".equals(param.methodName)
      && "(Ljava/lang/String;)Ljava/lang/Object;".equals(param.methodDesc)
      && param.methodParam instanceof String
      && "phone".equals(param.methodParam);//入参是 location
  }

  @Override
  String invokeHookMethodName() {
    return "invokePhoneState";
  }
}
